using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace P4Shelf
{
    public partial class RenameDialog : Form
    {
        private Form1 parent;
        public RenameDialog(Form1 parent)
        {
            InitializeComponent();
            this.parent = parent;
            this.SetTopLevel(true);
            this.Show(parent);
        }

        private void createtab_activate_Click(object sender, EventArgs e)
        {
            _Done();
        }

        private void Form2_FormClosed(object sender, FormClosedEventArgs e)
        {
            parent.RenameDialogClosed();
        }

        private void configtab_shelfdir_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((char)Keys.Enter == e.KeyChar)
            {
                _Done();
            }
        }

        private void _Done()
        {
            parent.RenameSelectedConnection(this.configtab_shelfdir.Text);
            this.Close();
        }
    }
}